﻿Class Win32
    Private Shared ReadOnly WM_SYSCOMMAND As Int32 = &H112
    Private Shared ReadOnly SC_SCREENSAVE As Int32 = &HF140

    Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
    Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

    Public Shared Sub ActivateScreensaver()

        Dim desktop As IntPtr = GetDesktopWindow()
        Dim lngResult As Long = SendMessage(desktop, WM_SYSCOMMAND, SC_SCREENSAVE, 0)
    End Sub
End Class